#include "Ctrl.h"

#if BridgePattern_

class Implementor
{
public:
	virtual void Operation() = 0;
};

class ConcreteImplementorA : public Implementor
{
public:
	void Operation() override {
		cout << "具体实现A的方法执行" << endl;
	}
};

class ConcreteImplementorB : public Implementor
{
public:
	void Operation() override {
		cout << "具体实现B的方法执行" << endl;
	}
};

class Abstraction 
{
protected:
	Implementor* m_pImp;
public:
	void SetImplementor(Implementor* _pImp) {
		m_pImp = _pImp;
	}
	virtual void Operation() {
		m_pImp->Operation();
	}
};

class RefinedAbstraction : public Abstraction
{
	void Operation() override {
		m_pImp->Operation();
	}
};



int main() {
	Abstraction* pAb = new RefinedAbstraction();
	pAb->SetImplementor(new ConcreteImplementorA());
	pAb->Operation();

	pAb->SetImplementor(new ConcreteImplementorB());
	pAb->Operation();

}




#endif